[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 Tips und Tricks

Diese Sparte ist zun�chst leer. Sollten sich Anfragen und Tips aus dem hoffentlich gro�en Kreis von ‘RSYS’-Benutzern, wird sich dieser Bereich f�llen.

Stop! Ein paar Tips habe ich schon :-)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Batch zum Debuggen von Programmen

Der folgende Batch (Name ‘tracer’) war mir beim Testen des Programmes sehr hilfreich:

.KEY onoff,program/A
.bra {
.KET }

if { program } eq ""
   echo "Aufruf: tracer [ON | OFF] [program]"
   quit
endif

if { onoff } eq ON
   assign t: doks:t
   cpu nofastrom
   run >NIL: <NIL: MungWall TASK {program}
   run >NIL: <NIL: IO_Torture
   run >NIL: <NIL: enforcer ON
   run sushi <>"CON:0/190//80/Sushi CTRL-E:Empty CTRL-F:File/AUTO/CLOSE"
             ON BUFK=1024
else
   if { onoff } eq OFF
      Utilities:ProgUtils/Sushi/sushi OFF
      run >NIL: <NIL: enforcer OFF
      tbreak IO_Torture
      tbreak MungWall
      cpu fastrom
      assign t: ram:t
   else
      echo "Aufruf: tracer [ON | OFF] <[program]>"
   endif
endif

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Das Programm tbreak

Das Programm ‘tbreak’ sendet einen Break-Signal an den Task, dessen Name als Parameter beim Aufruf mit angegeben wurde. Es ist ein kleines Programm, da� ich mal quick and dirty gehackt habe. Hier kommt der kleine Quelltext dazu:

#include <exec/types.h>
#include <exec/execbase.h>

#include <dos/dos.h>
#include <dos/dosextens.h>

#include <clib/dos_protos.h>
#include <clib/exec_protos.h>

#include <stdio.h>
#include <string.h>

#define STRINGEND '\0'

char *
B2CStr(char *ret, BSTR inp)
{
   register int i;
   char *help = (char *)BADDR(inp);

   for (i = 0; i < *help; i++)
      *(ret + i) = *(help + i + 1);

   *(ret + i) = STRINGEND;

   return (ret);
}

int
main(int argc,char **argv)
{
   struct DOSBase *DOSBase = NULL;
   extern struct ExecBase *SysBase;
   int ret = RETURN_FAIL;

   if(DOSBase = (struct DOSBase *)OpenLibrary((STRPTR)"dos.library", 33L))
   {
      struct Node *node,*membernode[200];
      struct CommandLineInterface *CLI;
      char modname[200];
      int i,j,out;

      if(argc != 2)
         Printf((STRPTR)"Aufruf: %s <taskname>\n",argv[0]);
      else
      {
         Forbid();
         Disable();

         for (node = SysBase->TaskWait.lh_Head;
              node->ln_Succ&& i < 200; node = node->ln_Succ)
            membernode[i++] = node;

         for (node = SysBase->TaskReady.lh_Head;
              node->ln_Succ && i < 200; node = node->ln_Succ)
            membernode[i++] = node;

         if (i < 200)
            membernode[i++] = &SysBase->ThisTask->tc_Node;

         Enable();

         out = FALSE;

         for (j = 0; j < i && !out && i < 200; j++)
         {
            struct Process *proc = (struct Process *)membernode[j];
            if(CLI = (struct CommandLineInterface *)BADDR(proc->pr_CLI))
            {
               B2CStr(modname,CLI->cli_CommandName);
               if (!strcmp(argv[1],modname))
               {
                  Signal((struct Task *)proc,
                         SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D |
                         SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F);
                  out = TRUE;
               }
            }
         }

         Permit();

         if(out == TRUE)
            Printf((STRPTR)"Task with command \'%s\' signaled...\n",argv[1]);
         if(i >= 200)
            PutStr((UBYTE *)"More than 200 tasks read!\n");

         ret = RETURN_OK;
      }
      CloseLibrary((struct Library *)DOSBase);
   }

   return(ret);
}

[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on February 9, 2022 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on February 9, 2022 using texi2html 5.0.